package com.ymx.darling.type;

import java.io.Reader;
import java.sql.*;

public class ReaderHandler implements TypeHandler<Reader> {
    @Override
    public Reader getResult(ResultSet resultSet, int columIndex) throws SQLException {
        Clob clob = resultSet.getClob(columIndex);
        return clob != null ? clob.getCharacterStream() : null;
    }

    @Override
    public void setParameter(PreparedStatement statement, Reader value, int index) throws SQLException {
        statement.setClob(index, value);
    }
}
